<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<img src="img/1.jpg" id="img_src"><br />
		<button type="button" onclick="img_bh2(event)">开始</button>
	</body>
	<script type="text/javascript">
	    // 随机打印
		function img_bh1(event){
			var img_src = document.getElementById('img_src')
			setInterval(function(){
				var num = sj();
				img_src.src = "img/"+num+".jpg";
			},100)
		}
		function sj(){
			var Num = 0;
			while(true){
				Num = Math.floor(Math.random()*10);
					if(Num!=0){
						break;
						}
					}			
			return Num;
		}
		
		// 顺序打印
		function img_bh2(event){
			var img_src = document.getElementById('img_src')
			var num = 2;
			setInterval(function(){
				img_src.src = "img/"+num+".jpg";
				num++;
				console.log(num)
				if(num == 10){
					num = 1;
				}
			},100)
		}
		
	</script>
</html>